<?php
namespace app\index\controller;

use app\index\Base;
use think\Db;
use think\Session;
use think\View;
use think\Request;

class Index extends Base
{
    /**
     * 首页
     * @return
     */
    public function index()
    {
        //模拟登陆
        $islogin = $this->_savelogin(2);
        if($islogin!=1) {
            exit('您还没有登录,请先登录');
        }


        return $this->view->fetch();
    }

    /**
     * 模拟登陆
     * @param $uid
     * @return int
     */
    private function _savelogin($uid){
        $user = Db::table('kyf_member_base')->where('m_uid='.$uid)->find();
        if($user){
            Session::set('user',$user);
            return 1;
        } else {
            return 0;
        }
    }


}
